<!DOCTYPE html>
<html lang="zh">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
	<meta name="author" content="小枫">
	<title>访问信息 | <%= data.title %></title>
	<link rel="shortcut icon" type="image/x-icon" href="<%= data.icon %>">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-touch-fullscreen" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="default">
	<link rel="stylesheet" type="text/css" href="/admin/css/materialdesignicons.min.css">
	<link rel="stylesheet" type="text/css" href="/admin/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/admin/css/animate.min.css">
	<link rel="stylesheet" type="text/css" href="/admin/css/style.min.css">
</head>

<body>
	<div class="container-fluid">

		<div class="row">
			<div class="col-lg-12">
				<div class="card">
					<header class="card-header">
						<div class="card-title">访问配置 <span class="badge bg-danger fw-bold">注意: 此功能需要开启redis后才能使用</span></div>
					</header>
					<div class="card-body">
						<form class="edit-form" id="accessConfigurationForm">
							<div class="mb-3">
								<label for="expirationTime" class="form-label">访问过期时间【单位: 秒】</label>
								<input class="form-control" type="number" min="1" id="expirationTime" name="expirationTime" placeholder="填写访问过期时间" required autocomplete="off">
								<small class="form-text">解释: 用户访问后将访问者的信息记录在内存里, 如果这里填写60将在60s后自动清除这个数据, 从而避免内存溢出。</small>
							</div>
							<div class="mb-3">
								<label for="accessTime" class="form-label">访问时间【单位: 秒】</label>
								<input class="form-control" type="number" min="1" id="accessTime" name="accessTime" placeholder="填写访问访问时间" required autocomplete="off">
								<small class="form-text">解释: 访问者在你设置的访问时间内记录对应的值</small>
							</div>
							<div class="mb-3">
								<label for="numberOfVisits" class="form-label">限制访问次数【单位: 秒】</label>
								<input class="form-control" type="number" min="1" id="numberOfVisits" name="numberOfVisits" placeholder="填写限制访问次数" required autocomplete="off">
								<small class="form-text">解释: 在你设置的访问时间内能访问多少次 (比如: 60s 访问 100次就会自动拉黑用户)</small>
							</div>
							<div class="mb-3">
								<label for="shield" class="form-label">拉黑时间【单位: 秒】</label>
								<input class="form-control" type="number" min="1" id="shield" name="shield" placeholder="填写限制访问次数" required autocomplete="off">
								<small class="form-text">解释: 用户被拉黑后多少时间解除访问限制</small>
							</div>
							<div>
								<button type="submit" class="btn btn-primary me-1">保 存</button>
							</div>
						</form>
					</div>
				</div>
			</div>

			<div class="col-lg-12">
				<div class="card">
					<header class="card-header">
						<div class="card-title">
							<div class="d-flex">
								<div class="p-2 flex-grow-1 pt-3">访问信息</div>
								<div class="p-2">
									<button class="btn btn-primary btn-w-md" type="button" onclick="synchronizationTime()">同步数据</button>
								</div>
							</div>
						</div>
					</header>
					<div class="card-body">
						<div class="mb-3">
							<label for="syncMinutes" class="form-label">访问信息同步时间【单位: 分钟】  <span class="badge bg-danger fw-bold">注意: 此功能需要开启redis后才能使用</span></label>
							<div class="input-group">
								<input class="form-control" type="number" min="1" id="syncMinutes" name="syncMinutes" placeholder="填写访问信息的同步时间" required autocomplete="off">
								<button class="btn btn-primary" type="button" id="setSyncMinutes">保存</button>
							  </div>
							<small class="form-text">解释: 就是把内存里的用户访问信息, 多少秒同步一次到数据库里。</small>
						</div>
						<div class="row">
							<div class="card-btns mb-2-5 col-lg-7 flex-row">
								<a class="btn btn-cyan me-1 mb-1" href="JavaScript:;" onclick="getIp('today')">获取今日IP</a>
								<a class="btn btn-cyan me-1 mb-1" href="JavaScript:;" onclick="getIp('aDay')">获取昨日IP</a>
								<a class="btn btn-cyan me-1 mb-1" href="JavaScript:;" onclick="getIp('all')">获取所有访问IP</a>
								<a class="btn btn-teal me-1 mb-1" href="JavaScript:;" onclick="getTableAddress()">获取当页IP地址</a>
							</div>
							<div class="card-btns mb-2-5 col-lg-5 flex-row flex-row-reverse">
								<a class="btn btn-outline-danger me-1 mb-1" href="JavaScript:;" onclick="deleteIp('today')">删除今日IP</a>
								<a class="btn btn-outline-danger me-1 mb-1" href="JavaScript:;" onclick="deleteIp('aDay')">删除昨日IP</a>
								<a class="btn btn-outline-danger me-1 mb-1" href="JavaScript:;" onclick="deleteIp('all')">删除所有访问IP</a>
							</div>
						</div>
						<div class="table-responsive" id="loading-dom">
							<table class="table table-bordered">
								<thead>
									<tr class="text-center">
										<th>编号</th>
										<th>访问IP</th>
										<th>访问次数</th>
										<th>操作系统</th>
										<th>访问时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody id="todayIP"></tbody>
							</table>
						</div>
						<ul class="pagination text-center" id="paginationDom"></ul>
					</div>
				</div>
			</div>
		</div>

	</div>
	<script type="text/javascript" src="/admin/js/jquery.min.js"></script>
	<script type="text/javascript" src="/admin/js/popper.min.js"></script>
	<script type="text/javascript" src="/admin/js/bootstrap.min.js"></script>
	<!-- 引入dayjs -->
	<script type="text/javascript" src="/admin/js/dayjs/dayjs.min.js"></script>
	<script type="text/javascript" src="/admin/js/dayjs/utc.js"></script>
	<script type="text/javascript" src="/admin/js/dayjs/timezone.js"></script>
	<!--引入notify插件js-->
	<script type="text/javascript" src="/admin/js/bootstrap-notify.min.js"></script>
	<!-- 引入ua识别插件 -->
	<script type="text/javascript" src="/admin/js/ua-parser.min.js"></script>
	<!--引入loading插件js-->
	<script type="text/javascript" src="/admin/js/lyear-loading.js"></script>
	<script type="text/javascript" src="/admin/js/sweetalert.min.js"></script>
	<script type="text/javascript" src="/admin/js/main.min.js"></script>
	<script type="text/javascript" src="/admin/js/nitai5pro/ip.js"></script>
</body>

</html>